package com.itheima.Demo4fileinputstream;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.OutputStream;

public class FileOutputStreamDemo1
{
    public static void main(String[] args) throws Exception {
        //创建一个输出流管道
//        OutputStream fos=new FileOutputStream("src\\com\\itheima\\Demo4fileinputstream\\file3");//覆盖管道
        OutputStream fos=new FileOutputStream("src\\com\\itheima\\Demo4fileinputstream\\file3", true);//追加管道
        fos.write(97);
        fos.write(98);
        //不能写入中文
        //要写入中文要用字节数组
        byte[] bytes = {97,98,99};
        fos.write(bytes);
        fos.write("梁".getBytes());
        byte[] bytes1="我爱你中国".getBytes();
        fos.write(bytes1);
        //关闭管道
        fos.close();
    }
}
